//
//  RankingListViewController.m
//  gpos_app
//
//  Created by apple on 2018/8/16.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "RankingListViewController.h"
#import "Masonry.h"
#import "RankingViewCell.h"
#import "GPosAPI.h"
#import "homeModel.h"
#import "UIImageView+WebCache.h"
#import "XMRegisterViewController.h"
#import "SVProgressHUD.h"
#import "WKProgressHUD.h"
@interface RankingListViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UIView * topView;
@property (nonatomic,strong)UIView * bottomView;
@property (nonatomic,strong)UITableView * tableView;
@property (nonatomic,strong)NSDictionary * params;
@property (nonatomic,strong)NSString * myName;
@property (nonatomic,strong)NSString * myAmount;
@property (nonatomic,strong)NSString * myPortrait;
@property (nonatomic,strong)NSString * myRank;
@property (nonatomic,strong)NSMutableArray *PageArr;
@property (nonatomic,assign)int page;
@property (nonatomic,strong)UIButton *syyButton;
@property (nonatomic,strong)UIButton *xyyButton;
@property (nonatomic,assign)float totalSize;
@property (nonatomic,strong)WKProgressHUD * husd;

@end

@implementation RankingListViewController

//改变状态栏
-(void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
}
-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"总排名";
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    self.page = 1;
    if ([self.ison isEqualToString:@"0"]) {
        self.title = @"总量排名";
        
         [self loadWangluoView];
       

        
    }else {
        self.title = @"今日新增用户";
        
        [self loadTodayView];
     
    }
    
    
    
}

- (void)loadTodayView{
    
//    int user = [[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
    self.params = @{
                    @"currentPage" : @(self.page),//页码
                    @"pageSize" : @(10)//行数
                    };
    [GPosAPI requestTodayRankWithParams:self.params andCallback:^(id obj) {
        if (obj==nil) {
            
        }else if ([[obj objectForKey:@"code"] intValue] == 200 ){
            NSLog(@"jinri--%@",obj);
            NSDictionary * dict = [obj objectForKey:@"data"];
            self.myName = [[dict objectForKey:@"selfRank"] objectForKey:@"nickName"];
//            float amount = [[[dict objectForKey:@"selfRank"] objectForKey:@"amount"] floatValue];
//            NSNumber * nsNumber1 = @(amount);
            self.myAmount = [NSString stringWithFormat:@"%@",[[dict objectForKey:@"selfRank"] objectForKey:@"amount"]];
            int rank = [[[dict objectForKey:@"selfRank"] objectForKey:@"rank"] intValue];
            self.myRank = [NSString stringWithFormat:@"%d",rank];
            self.myPortrait = [[dict objectForKey:@"selfRank"] objectForKey:@"portrait"];
            self.totalSize = [[dict objectForKey:@"totalSize"] intValue];
            self.PageArr = [[NSMutableArray alloc] init];
            NSArray * arr = [[NSArray alloc] init];
            arr = [dict objectForKey:@"rankPage"];
            for (NSDictionary * dic in arr) {
                homeModel *model = [[homeModel alloc] init];
                model.amount = [dic objectForKey:@"amount"];
                model.nickName = [dic objectForKey:@"nickName"];
                model.rank = [[dic objectForKey:@"rank"] intValue];
                model.portrait = [dic objectForKey:@"portrait"];
                [self.PageArr addObject:model];
                //                                NSLog(@"图片--%@",model);
            }
            
        }else if ([[obj objectForKey:@"code"] intValue] == 401 || [[obj objectForKey:@"code"] intValue] == 402){
            UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
            [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
            //storyboard里的ID
            XMRegisterViewController *vc = [mainStory instantiateInitialViewController];
            vc.navigationController.navigationBarHidden=NO;
            //                    //设置当前窗口的根控制器
            
            [UIApplication sharedApplication].keyWindow.rootViewController=vc;
            [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            
        }else {
            
            self.husd=[WKProgressHUD popMessage:[obj objectForKey:@"message"] inView:self.view duration:1 animated:YES];
        }
        
        
        [self topBottomLoadView];
        [self LoadTableView];
        
    }];
}

- (void)loadWangluoView{
    int user = [[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
    
    self.params = @{@"userId" : @(user),
                    @"currentPage" : @(self.page),//页码
                    @"pageSize" : @(10)//行数
                    };
    NSLog(@"sel---%@",self.params);
    [GPosAPI requestAllRankWithParams:self.params andCallback:^(id obj) {
        NSLog(@"obj--%@",obj);
        if (obj==nil) {
            
        }else if ([[obj objectForKey:@"code"] intValue] == 200 ){
            NSDictionary * dict = [obj objectForKey:@"data"];
            self.myName = [[dict objectForKey:@"selfRank"] objectForKey:@"nickName"];
//            float amount = [[[dict objectForKey:@"selfRank"] objectForKey:@"amount"] floatValue];
//             NSNumber * nsNumber1 = @(amount);
            self.myAmount = [NSString stringWithFormat:@"%@",[[dict objectForKey:@"selfRank"] objectForKey:@"amount"]];
            int rank = [[[dict objectForKey:@"selfRank"] objectForKey:@"rank"] intValue];
            self.myRank = [NSString stringWithFormat:@"%d",rank];
            self.myPortrait = [[dict objectForKey:@"selfRank"] objectForKey:@"portrait"];
            self.totalSize = [[dict objectForKey:@"totalSize"] intValue];
            self.PageArr = [[NSMutableArray alloc] init];
            NSArray * arr = [[NSArray alloc] init];
            arr = [dict objectForKey:@"rankPage"];
            for (NSDictionary * dic in arr) {
                homeModel *model = [[homeModel alloc] init];
                 NSDecimalNumber * number = [dic objectForKey:@"amount"];
                model.amount = [NSString stringWithFormat:@"%@",@(number.floatValue)];
//                model.amount = [NSString stringWithFormat:@"%@",number];;
                model.nickName = [dic objectForKey:@"nickName"];
                model.rank = [[dic objectForKey:@"rank"] intValue];
                model.portrait = [dic objectForKey:@"portrait"];
                [self.PageArr addObject:model];
                //                                NSLog(@"图片--%@",model);
            }
            
        }else if ([[obj objectForKey:@"code"] intValue] == 401 || [[obj objectForKey:@"code"] intValue] == 402){
            UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
            [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
            //storyboard里的ID
            XMRegisterViewController *vc = [mainStory instantiateInitialViewController];
            vc.navigationController.navigationBarHidden=NO;
            //                    //设置当前窗口的根控制器
            
            [UIApplication sharedApplication].keyWindow.rootViewController=vc;
            [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            
        }else {
            
            self.husd=[WKProgressHUD popMessage:[obj objectForKey:@"message"] inView:self.view duration:1 animated:YES];
        }
        
        [self topBottomLoadView];
        [self LoadTableView];
        
    }];
    
}
- (void)LoadTableView {
    UILabel * label = [[UILabel alloc] init];
    label.frame = CGRectMake(0, 0, 60, 40);
    label.text = [NSString stringWithFormat:@"%.f人",self.totalSize];
    label.textColor = [UIColor grayColor];
    label.textAlignment=NSTextAlignmentRight;
    label.font = [UIFont systemFontOfSize:13];
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:label];
    self.navigationItem.rightBarButtonItem = rightItem;
  
    
    self.tableView = [[UITableView alloc] init];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topView.mas_bottom).with.offset(0);
        make.left.equalTo(self.view).with.offset(0);
        make.right.equalTo(self.view).with.offset(0);
        make.bottom.equalTo(self.bottomView.mas_top).with.offset(0);
        
    }];
    UIView * footerView = [[UIView alloc] init];
    footerView.backgroundColor = [UIColor colorWithRed:244/255.0f green:244/255.0f blue:244/255.0f alpha:1];
    self.tableView.tableFooterView = footerView;
    
   
    self.syyButton = [UIButton buttonWithType:UIButtonTypeCustom];
    if (self.page > 1) {
        self.syyButton.userInteractionEnabled=YES;
        [self.syyButton setTitleColor:[UIColor blueColor]forState:UIControlStateNormal];
    }else {
        
         self.syyButton.userInteractionEnabled=NO;
        [self.syyButton setTitleColor:[UIColor grayColor]forState:UIControlStateNormal];
    }
    [self.syyButton setTitle:@"上一页" forState:UIControlStateNormal];
    self.syyButton.titleLabel.font = [UIFont systemFontOfSize: 15.0];
    
    [self.tableView addSubview:self.syyButton];
    
    self.xyyButton = [UIButton buttonWithType:UIButtonTypeCustom];
    float srrr = ceilf(self.totalSize/10) ;
//    NSLog(@"srrr--%f",srrr);
    
    NSString *stringInt = [NSString stringWithFormat:@"%f",srrr];
    
    if ([stringInt intValue] > self.page ) {
        self.xyyButton.userInteractionEnabled=YES;
        [self.xyyButton setTitleColor:[UIColor blueColor]forState:UIControlStateNormal];
    }else {
        self.xyyButton.userInteractionEnabled=NO;
        [self.xyyButton setTitleColor:[UIColor grayColor]forState:UIControlStateNormal];
    }
    [self.xyyButton setTitle:@"下一页" forState:UIControlStateNormal];
    self.xyyButton.titleLabel.font = [UIFont systemFontOfSize: 15.0];
    
    [self.tableView addSubview:self.xyyButton];
    
    [@[self.syyButton, self.xyyButton] mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:(KmainScreenWidth-100)/3 leadSpacing:(KmainScreenWidth-90)/3 tailSpacing:(KmainScreenWidth-100)/3];
    
    [@[self.syyButton, self.xyyButton] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.bottomView.mas_top).with.offset(-10);
        make.width.equalTo(@50);
    }];
    
    [self.syyButton addTarget:self action:@selector(syyButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.xyyButton addTarget:self action:@selector(xyyButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
}
- (void)topBottomLoadView {
    self.topView  = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor colorWithRed:70/255.0f green:85/255.0f blue:254/255.0f alpha:1];
    [self.view addSubview:self.topView];
    self.bottomView  = [[UIView alloc] init];
    self.bottomView.backgroundColor = [UIColor colorWithRed:70/255.0f green:85/255.0f blue:254/255.0f alpha:1];
    [self.view addSubview:self.bottomView];
    if (iPhoneX) {
        [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.view).with.offset(kNavbarHeight);
            make.left.equalTo(self.view).with.offset(0);
            make.right.equalTo(self.view).with.offset(0);
            make.height.equalTo(@50);
        }];
        
        [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).with.offset(-kBottomSafeHeight);
            make.left.equalTo(self.view).with.offset(0);
            make.right.equalTo(self.view).with.offset(0);
            make.height.equalTo(@55);
        }];
        
    }else {
        [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.view).with.offset(64);
            make.left.equalTo(self.view).with.offset(0);
            make.right.equalTo(self.view).with.offset(0);
            make.height.equalTo(@50);
        }];
        
        [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).with.offset(0);
            make.left.equalTo(self.view).with.offset(0);
            make.right.equalTo(self.view).with.offset(0);
            make.height.equalTo(@55);
        }];
        
    }
    
    UILabel * oneLabel = [[UILabel alloc] init];
    oneLabel.text = @"名次";
    oneLabel.textColor = [UIColor whiteColor];
    oneLabel.textAlignment=NSTextAlignmentCenter;
    oneLabel.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:oneLabel];
    
    UILabel * twoLabel = [[UILabel alloc] init];
    twoLabel.text = @"";
    twoLabel.textAlignment=NSTextAlignmentCenter;
    twoLabel.textColor = [UIColor whiteColor];
    twoLabel.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:twoLabel];
    
    UILabel * threeLabel = [[UILabel alloc] init];
    threeLabel.text = @"";
    threeLabel.textAlignment=NSTextAlignmentCenter;
    threeLabel.textColor = [UIColor whiteColor];
    threeLabel.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:threeLabel];
    
    [@[oneLabel, twoLabel, threeLabel] mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:20 leadSpacing:20 tailSpacing:20];
    
    [@[oneLabel, twoLabel, threeLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.topView);
        //        make.width.equalTo
        make.width.mas_equalTo(threeLabel.mas_width);
    }];
    
    UIView * oneView = [[UIView alloc] init];
    oneView.backgroundColor = [UIColor whiteColor];
    [self.topView addSubview:oneView];
    
    UIView * twoView = [[UIView alloc] init];
    twoView.backgroundColor = [UIColor whiteColor];
    [self.topView addSubview:twoView];
    
    [@[oneView, twoView] mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:(KmainScreenWidth-1)/3 leadSpacing:(KmainScreenWidth-1)/3 tailSpacing:(KmainScreenWidth-1)/3];
    
    [@[oneView, twoView] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topView).with.offset(15);
        make.bottom.equalTo(self.topView).with.offset(-15);
        //        make.width.equalTo
        //        make.height.mas_equalTo(threeLabel.mas_height);
        make.width.equalTo(@0.5);
    }];
    
    UILabel * twoNameLabel = [[UILabel alloc] init];
    twoNameLabel.text = @"昵称";
    twoNameLabel.textAlignment=NSTextAlignmentCenter;
    twoNameLabel.textColor = [UIColor whiteColor];
    twoNameLabel.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:twoNameLabel];
    [twoNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(oneView.mas_right).with.offset(10);
        make.right.equalTo(self.topView).with.offset(-10);
        make.center.equalTo(twoView);
    }];
    twoView.hidden = YES;
    UIView * onebottomView = [[UIView alloc] init];
    onebottomView.backgroundColor = [UIColor whiteColor];
    [self.bottomView addSubview:onebottomView];
    
    UIView * twobottomView = [[UIView alloc] init];
    twobottomView.backgroundColor = [UIColor whiteColor];
    [self.bottomView addSubview:twobottomView];
    
    [@[onebottomView, twobottomView] mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:(KmainScreenWidth-1)/3 leadSpacing:(KmainScreenWidth-1)/3 tailSpacing:(KmainScreenWidth-1)/3];
    
    [@[onebottomView, twobottomView] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bottomView).with.offset(10);
        make.bottom.equalTo(self.bottomView).with.offset(-10);
        //        make.width.equalTo
        //        make.height.mas_equalTo(threeLabel.mas_height);
        make.width.equalTo(@0.5);
    }];
    twobottomView.hidden = YES;
    UILabel * zjnameLabel = [[UILabel alloc] init];
    
    zjnameLabel.textAlignment=NSTextAlignmentCenter;
    zjnameLabel.textColor = [UIColor whiteColor];
    zjnameLabel.font = [UIFont systemFontOfSize:14];
    [self.bottomView addSubview:zjnameLabel];
    [zjnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.bottomView);
        make.left.equalTo(onebottomView.mas_right).with.offset(5);
        make.right.equalTo(self.bottomView).with.offset(-5);
    }];
    
    UILabel * gposLabel = [[UILabel alloc] init];
    
    gposLabel.textAlignment=NSTextAlignmentCenter;
    gposLabel.textColor = [UIColor whiteColor];
    gposLabel.font = [UIFont systemFontOfSize:14];
    [self.bottomView addSubview:gposLabel];
    [gposLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.bottomView);
        make.left.equalTo(twobottomView.mas_right).with.offset(5);
        make.right.equalTo(self.bottomView).with.offset(-5);
    }];
    
    UILabel * qushiLabel = [[UILabel alloc] init];
    qushiLabel.textAlignment=NSTextAlignmentCenter;
    qushiLabel.textColor = [UIColor whiteColor];
    qushiLabel.font = [UIFont systemFontOfSize:14];
    [self.bottomView addSubview:qushiLabel];
    [qushiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.bottomView);
        make.left.equalTo(self.bottomView).with.offset(12);
        
    }];
    
    //icon_ss
    UIImageView * qsImage = [[UIImageView alloc] init];
    [self.bottomView addSubview:qsImage];
    [qsImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(qushiLabel.mas_right).with.offset(2);
        make.centerY.equalTo(self.bottomView);
        
    }];
    
    UILabel * paimingLabel = [[UILabel alloc] init];
    paimingLabel.textAlignment=NSTextAlignmentCenter;
    paimingLabel.textColor = [UIColor whiteColor];
    paimingLabel.font = [UIFont systemFontOfSize:14];
    [self.bottomView addSubview:paimingLabel];
    [paimingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.bottomView);
        make.left.equalTo(qsImage.mas_right).with.offset(5);
        
    }];
    
    UIImageView * nameImage = [[UIImageView alloc] init];
    //    nameImage.backgroundColor = [UIColor whiteColor];
    nameImage.layer.cornerRadius = 12;
    nameImage.clipsToBounds=YES;
    [self.bottomView addSubview:nameImage];
    
    [nameImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(paimingLabel.mas_right).with.offset(5);
        make.centerY.equalTo(self.bottomView);
        make.width.equalTo(@25);
        make.height.equalTo(@25);
        
    }];
    
    NSLog(@"----%@",self.myName);
    qushiLabel.text = @"";
    gposLabel.text = @"";
    zjnameLabel.text = self.myName;
    paimingLabel.text = self.myRank;
    int num = [qushiLabel.text intValue];
    
    if (num < 0) {
        qsImage.image = [UIImage imageNamed:@"icon_ss"];
        
    }else if (num > 0) {
        qsImage.image = [UIImage imageNamed:@"icon_xj"];
        
    }
    
//    NSString *urlStr = [[[NSUserDefaults standardUserDefaults] objectForKey:@"portrait"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    [nameImage sd_setImageWithURL:[NSURL URLWithString:self.myPortrait] placeholderImage:[UIImage imageNamed:@"icon_txiang"]];
    
    
    
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.PageArr.count;
}
//上一页
- (void)syyButtonAction:(UIButton *)sender {
    NSLog(@"上一页");
//    self.syyButton.userInteractionEnabled = NO;
// [[self class]
    self.syyButton.userInteractionEnabled =NO;
    [self performSelector:@selector(SyyButtonAction)withObject:nil afterDelay:1.5f];
    

}
- (void)SyyButtonAction{
//    self.syyButton.userInteractionEnabled =YES;
    self.page = self.page-1;
    
    NSLog(@"page--%d",self.page);
    if ([self.ison isEqualToString:@"0"]) {
        [self loadWangluoView];
        //        self.syyButton.userInteractionEnabled = YES;
    }else {
        
        [self loadTodayView];
        //        self.syyButton.userInteractionEnabled = YES;
    }
    
}
- (void)xyyButtonAction:(UIButton *)sender {
    NSLog(@"下一页");
    self.xyyButton.userInteractionEnabled =NO;
    [self performSelector:@selector(XyyButtonAction)withObject:nil afterDelay:1.5f];

}
- (void)XyyButtonAction{
//    self.xyyButton.userInteractionEnabled =YES;
    if (self.page<10) {
        self.page = self.page+1;
        NSLog(@"page--%d",self.page);
        if ([self.ison isEqualToString:@"0"]) {
            [self loadWangluoView];
            
        }else {
            
            [self loadTodayView];
            
        }
        
    }
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{//rankingCell
//    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
//    if (!cell) {
//        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
//    }
//    cell.textLabel.text = @"测试数据";
    RankingViewCell * cell = [[RankingViewCell alloc] init];
//    if (indexPath.section == 0) {
    
    
    cell = [tableView dequeueReusableCellWithIdentifier:@"rankingCell"];
        
    if (!cell) {
            cell = [[[NSBundle mainBundle] loadNibNamed:@"RankingViewCell" owner:self options:nil] firstObject];
    }
    
    cell.touxiangImageView.layer.cornerRadius = 12;
    cell.touxiangImageView.clipsToBounds=YES;
    cell.yhNameLabel.text = [self.PageArr[indexPath.row] nickName];
//     NSNumber * nsNumber1 = @([self.PageArr[indexPath.row] amount]);
//    cell.GposslLabel.text = [NSString stringWithFormat:@"%@",[self.PageArr[indexPath.row] amount]] ;
    cell.paihanglabel.text = [NSString stringWithFormat:@"%d",[self.PageArr[indexPath.row] rank]] ;
//    cell.paihanglabel.text = [self.PageArr[indexPath.row] rank];
     [cell.touxiangImageView sd_setImageWithURL:[NSURL URLWithString:[self.PageArr[indexPath.row] portrait]] placeholderImage:[UIImage imageNamed:@"icon_tx_jx"]];
    if ([self.PageArr[indexPath.row] rank]==1) {
        cell.huangguanImageView.image = [UIImage imageNamed:@"icon_jin"];
         cell.huangguanImageView.hidden=NO;
    }else if ([self.PageArr[indexPath.row] rank]==2) {
        cell.huangguanImageView.image = [UIImage imageNamed:@"icon_yin"];
         cell.huangguanImageView.hidden=NO;
    }else if ([self.PageArr[indexPath.row] rank]==3) {
        cell.huangguanImageView.image = [UIImage imageNamed:@"icon_tong"];
         cell.huangguanImageView.hidden=NO;
    }else {
//
        cell.huangguanImageView.hidden = YES;
    }
    return cell;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.hidesBottomBarWhenPushed=YES;
    }
    return self;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
